package com.ilxqx.framework.system.form.update;

import com.ilxqx.framework.system.enumeration.SysUserStatusEnum;
import com.ilxqx.framework.system.form.UpdateForm;
import com.ilxqx.framework.system.form.anno.Pk;
import com.ilxqx.framework.system.service.impl.SysUserServiceImpl;
import com.ilxqx.framework.system.validator.anno.*;
import com.ilxqx.framework.system.validator.group.FrameworkGroups;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Positive;
import javax.validation.constraints.Size;

/**
 * 用户更新表单类
 * @author venus
 */
@Data
@Unique(message = "用户账号{unique}", service = SysUserServiceImpl.class, method = "accountExists", field = "account")
public class SysUserUpdateForm implements UpdateForm {

	/**
	 * 用户主键
	 */
	@Pk
	@NotNull(groups = FrameworkGroups.Modify.class, message = "用户主键{required}")
	@Positive(groups = FrameworkGroups.Modify.class, message = "用户主键{positive}")
	private Long userId;

	/**
	 * 用户账号
	 */
	@Size(max = 16, message = "用户账号{size}")
	@AlphaNum(message = "用户账号{alphaNum}")
	private String account;

	/**
	 * 用户密码
	 */
	@Size(max = 64, message = "用户密码{size}")
	@AlphaNumDash(message = "用户密码{alphaDash}")
	private String password;

	/**
	 * 用户姓名
	 */
	@Size(max = 8, message = "用户姓名{size}")
	@Chinese(message = "用户姓名{chinese}")
	private String name;

	/**
	 * 用户头像
	 */
	@Size(max = 256, message = "用户头像{size}")
	private String avatar;

	/**
	 * 联系电话
	 */
	@NotBlank(message = "联系电话{required}")
	@Size(max = 16, message = "联系电话{size}")
	@Phone(message = "联系电话{phone}")
	private String phone;

	/**
	 * 联系邮箱
	 */
	@NotBlank(message = "联系邮箱{required}")
	@Size(max = 32, message = "联系邮箱{size}")
	@com.ilxqx.framework.system.validator.anno.Email(message = "联系邮箱{email}")
	private String email;

	/**
	 * 用户备注
	 */
	@Size(max = 256, message = "用户备注{size}")
	private String remark;

	/**
	 * 用户状态
	 */
	private SysUserStatusEnum status;

}
